package com.industrial.premu.service.impl.sqsj;

import java.util.List;

import com.industrial.common.security.utils.SecurityUtils;
import com.industrial.premu.domain.sqsj.PreMuImportAddSubstract;
import com.industrial.premu.domain.sqsj.PreMuImportLog;
import com.industrial.premu.mapper.sqsj.PreMuImportAddSubstractMapper;
import com.industrial.premu.mapper.sqsj.PreMuImportLogMapper;
import com.industrial.premu.service.IPreMuImportAddSubstractService;
import com.industrial.premu.service.IPreMuImportLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


/**
 * 亩产导入数据-加减分项Service业务层处理
 *
 * @author ruoyi
 * @date 2024-01-26
 */
@Service
public class PreMuImportAddSubstractServiceImpl implements IPreMuImportAddSubstractService
{
    @Autowired
    private PreMuImportAddSubstractMapper preMuImportAddSubstractMapper;



    /**
     * 查询亩产导入数据-加减分项
     *
     * @param id 亩产导入数据-加减分项主键
     * @return 亩产导入数据-加减分项
     */
    @Override
    public PreMuImportAddSubstract selectPreMuImportAddSubstractById(String id)
    {
        return preMuImportAddSubstractMapper.selectPreMuImportAddSubstractById(id);
    }

    /**
     * 查询亩产导入数据-加减分项列表
     *
     * @param preMuImportAddSubstract 亩产导入数据-加减分项
     * @return 亩产导入数据-加减分项
     */
    @Override
    public List<PreMuImportAddSubstract> selectPreMuImportAddSubstractList(PreMuImportAddSubstract preMuImportAddSubstract)
    {
        return preMuImportAddSubstractMapper.selectPreMuImportAddSubstractList(preMuImportAddSubstract);
    }

    /**
     * 新增亩产导入数据-加减分项
     *
     * @param preMuImportAddSubstract 亩产导入数据-加减分项
     * @return 结果
     */
    @Override
    public int insertPreMuImportAddSubstract(PreMuImportAddSubstract preMuImportAddSubstract)
    {
        return preMuImportAddSubstractMapper.insertPreMuImportAddSubstract(preMuImportAddSubstract);
    }

    /**
     * 修改亩产导入数据-加减分项
     *
     * @param preMuImportAddSubstract 亩产导入数据-加减分项
     * @return 结果
     */
    @Override
    public int updatePreMuImportAddSubstract(PreMuImportAddSubstract preMuImportAddSubstract)
    {
        return preMuImportAddSubstractMapper.updatePreMuImportAddSubstract(preMuImportAddSubstract);
    }

    /**
     * 批量删除亩产导入数据-加减分项
     *
     * @param ids 需要删除的亩产导入数据-加减分项主键
     * @return 结果
     */
    @Override
    public int deletePreMuImportAddSubstractByIds(String[] ids)
    {
        return preMuImportAddSubstractMapper.deletePreMuImportAddSubstractByIds(ids);
    }

    /**
     * 删除亩产导入数据-加减分项信息
     *
     * @param id 亩产导入数据-加减分项主键
     * @return 结果
     */
    @Override
    public int deletePreMuImportAddSubstractById(String id)
    {
        return preMuImportAddSubstractMapper.deletePreMuImportAddSubstractById(id);
    }

    @Override
    public List<PreMuImportAddSubstract> getImportExistList(PreMuImportAddSubstract preMuImportAddSubstractQuery) {
        return preMuImportAddSubstractMapper.getImportExistList(preMuImportAddSubstractQuery);
    }

    @Override
    public int batchSave(List<PreMuImportAddSubstract> addImportList) {
        return preMuImportAddSubstractMapper.batchSave(addImportList);
    }

    @Override
    public int batchUpdate(List<PreMuImportAddSubstract> updateImportList) {
        return preMuImportAddSubstractMapper.batchUpdate(updateImportList);
    }
    @Autowired
    private PreMuImportLogMapper preMuImportLogMapper;
    @Override
    public void removeData(PreMuImportAddSubstract queryParams,String deptCode) {
        preMuImportAddSubstractMapper.removeData(queryParams);
        PreMuImportLog removeParams = new PreMuImportLog();
        removeParams.setYear(queryParams.getYear());
        removeParams.setCounty(SecurityUtils.getLoginUser().getSysUser().getDistrict());
        removeParams.setDeptCode(deptCode);
        preMuImportLogMapper.removeData(removeParams);
    }


}